<%@ page import="org.springframework.web.context.support.WebApplicationContextUtils" %>
<%@ page import="org.springframework.web.context.WebApplicationContext" %>
<%@ page import="org.lxy.service.InfomationService" %>
<%@ page import="cn.hutool.core.bean.BeanUtil" %>
<%@ page import="java.util.List" %>
<%@ page import="org.lxy.service.RecyclePointService" %>
<%@ page import="org.lxy.service.RecycleGoodsService" %>
<%@ page import="org.lxy.service.GoodsTypeService" %>
<%@ page import="org.lxy.domain.*" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no">
<title>闲置物品回收</title>
<meta name="keywords" content="HTML5,CSS3,HTML,Template,Themeton">
<meta name="description"
	content="Cloudy Town - Simple Blog HTML Template">
<meta name="author" content="Themeton">
<!-- Favicon -->
<link rel="shortcut icon" type="image/x-icon" href="/images/favicon.png" />
<!-- Fonts -->
<!-- Bootstrap -->
<link rel="stylesheet" type="text/css"
	href="/vendors/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css"
	href="/vendors/bootstrap/css/bootstrap-theme.min.css">
<!-- Fontawesome -->
<link rel="stylesheet" type="text/css"
	href="/vendors/font-awesome/css/font-awesome.min.css">
<!-- Swiper -->
<link rel="stylesheet" type="text/css"
	href="/vendors/swiper/css/swiper.min.css">
<!-- Magnific-popup -->
<link rel="stylesheet" type="text/css" href="/style.css">
<link rel="stylesheet" type="text/css" href="/css/welcome.css">
</head>
<body>
<header id="header">
	<div class="logo" data-bg-image="images/bg-header.jpg">
		<h1>
			<a href="Home.jsp">闲置物品回收</a>
		</h1>
		<p></p>
	</div>
	<div class="menu-container">
		<div class="container">
			<div class="row">
				<div class="col-md-7">
					<nav class="main-nav">
						<ul>
							<li class=" current-menu-item menu-item-has-children"><a
									href="/home">首页</a></li>
							<li><a href="/zixunlist">资讯</a></li>
							<li><a href="/huishouwulist">兑换物品</a></li>
							<li><a href="/shangmenhuishou">上门回收</a></li>
							<li><a href="/huishoudianhuishou">回收点回收</a></li>
							<%

								WebApplicationContext context= WebApplicationContextUtils.getWebApplicationContext(application);
								InfomationService infomationService = context.getBean(InfomationService.class);
								UserInfoEntity account = (UserInfoEntity) request.getSession().getAttribute("Account");
								if (account == null) {
							%>
							<li><a href="/login">登录</a></li>
							<li><a href="/register">注册</a></li>
							<%
							}else{
							%>
							<li><a href="/wodejuanzengwu">我的捐赠物</a></li>
							<li><a href="/wodeduihuanwu">我的兑换物</a></li>
							<%
								}
							%>
						</ul>
						<a href="javascript:;" id="close-menu"> <i
								class="fa fa-close"></i></a>
					</nav>
				</div>
				<div class=" col-md-5 h-search">
					<form class="search_form">
						<input type="text" name="2" placeholder="Search and hit enter...">
						<button type="submit">
							<i class="fa fa-search"></i>
						</button>
					</form>
				</div>
			</div>
		</div>
	</div>
</header>
<section class="section-content">
	<div class="container">
		<div class="row">
			<div class="col-sm-8 col-md-8">
				<%
					List<InfomationEntity> infomationEntities = infomationService.listByMap(BeanUtil.beanToMap(InfomationEntity.builder().status("1").build(), true, true));
					for (InfomationEntity item : infomationEntities) {
				%>
				<article class="content-item">
					<div class="entry-media">
						<div class="post-ribbon">
							<i class="fa fa-star"></i>
						</div>
						<div class="post-title">
							<h2>
								<a href="#"><%=item.getTitle()%></a>
							</h2>
						</div>
						<div class="bubble-line"></div>
						<div class="post-content">
							<div class="container gallery">
								<div class="row">
									<div class="col-xs-12 photos ">
										<a class="photos"><img
												src="<%=item.getImg()%>" alt="not image1"></a>
									</div>
								</div>
							</div>
							<p><%=item.getInfo()%></p>
						</div>
						<div class="bubble-line"></div>
						<div class="post-footer">
							<div class="row">
								<div class="col-sm-6">
									<a href="/zixundetail?id=<%=item.getId() %>" class="button">详情</a>
								</div>
							</div>
						</div>
					</div>
				</article>
				<%
					}
				%>
			</div>
			<div class="col-sm-4 sidebar">
				<div class="widget">
					<h3 class="widget-title">回收点</h3>
					<div class="bubble-line"></div>
					<div class="widget-content">
						<ul>
							<%
								RecyclePointService recyclePointService = context.getBean(RecyclePointService.class);
								List<RecyclePointEntity> list = recyclePointService.list();
								for (RecyclePointEntity item : list) {
							%>
							<li>
								<p style="margin-top: 0px;">
									<a href="javascript:;"> <%=item.getName()%></a>
								</p>
								<p style="float: right; line-height: 25px; margin-top: 0px;"><%=item.getAddress()%></p>
								<div style="clear: both"></div>
							</li>
							<%
								}
							%>
						</ul>
					</div>
				</div>
				<div class="widget">
					<h3 class="widget-title">物品兑换</h3>
					<div class="bubble-line"></div>
					<div class="widget-content">
						<%
							RecycleGoodsService recycleGoodsService = context.getBean(RecycleGoodsService.class);
							List<RecycleGoodsEntity> recycleGoodsEntities = recycleGoodsService.listByMap(BeanUtil.beanToMap(RecycleGoodsEntity.builder().status("兑换中").build(), true, true));
							for (RecycleGoodsEntity item : recycleGoodsEntities) {
						%>
						<div class="widget-recent">
							<img src="<%=item.getImg() %>" alt="not image">
							<h4>
								<a href="javascript:;"><%=item.getName()%></a>
							</h4>
						</div>
						<%
							}
						%>
					</div>
				</div>
				<div class="widget widget-sub">
					<h5>用过去换一个未来</h5>
					<p>一起换吧，拒绝平庸，打破常规，塑造创意的灵魂；以物易物，以物会友，讲述宝贝故事，体验互换乐趣；闲置物品，
						一起换吧，安全担保交易，分享交换的喜悦；与其放着发霉，不如让闲置传递！与其留着落灰，
						不如把闲置交换！一起换吧——领先的闲置物品置换担保交易平台，安全便捷、时尚好玩！</p>
				</div>
				<div class="widget-sub social">
					<ul>
						<%
							GoodsTypeService goodsTypeService = context.getBean(GoodsTypeService.class);
							for (GoodsTypeEntity item : goodsTypeService.list()) {
								int count = recycleGoodsService.listByMap(BeanUtil.beanToMap(RecycleGoodsEntity.builder().typeId(item.getId()).build(), true, true)).size();
						%>
						<li><a class="social-widget" href="javascript:;"> <i
								class="fa fa-twitter"></i> <span><%=item.getName()%></span></a>
							<div><%=count%></div></li>
						<%
							}
						%>
					</ul>
				</div>
			</div>
		</div>
	</div>
</section>
<footer id="footer">
	<div class="footer-slide">
		<div class="swiper-container">
			<div class="swiper-wrapper">
				<div
						class="swiper-slide fslide col-xs-6 col-sm-4 col-md-3 col-lg-2">
					<a href="#" class="thumbnails"><img
							src="/images/footer/photos2.jpg" alt="Image"></a>
				</div>
				<div
						class="swiper-slide fslide col-xs-6 col-sm-4 col-md-3 col-lg-2">
					<a href="#" class="thumbnails"><img
							src="/images/footer/photos1.jpg" alt="Image"></a>
				</div>
				<div
						class="swiper-slide fslide col-xs-6 col-sm-4 col-md-3 col-lg-2">
					<a href="#" class="thumbnails"><img
							src="/images/footer/01-footer.jpg" alt="Image"></a>
				</div>
				<div
						class="swiper-slide fslide col-xs-6 col-sm-4 col-md-3 col-lg-2">
					<a href="#" class="thumbnails"><img
							src="/images/footer/02-footert.jpg" alt="Image"></a>
				</div>
				<div
						class="swiper-slide fslide col-xs-6 col-sm-4 col-md-3 col-lg-2">
					<a href="#" class="thumbnails"><img
							src="/images/footer/photos4.jpg" alt="Image"></a>
				</div>
				<div
						class="swiper-slide fslide col-xs-6 col-sm-4 col-md-3 col-lg-2">
					<a href="#" class="thumbnails"><img
							src="/images/footer/photos5.jpg" alt="Image"></a>
				</div>
				<div
						class="swiper-slide fslide col-xs-6 col-sm-4 col-md-3 col-lg-2">
					<a href="#" class="thumbnails"><img
							src="/images/footer/photos7.jpg" alt="Image"></a>
				</div>
				<div
						class="swiper-slide fslide col-xs-6 col-sm-4 col-md-3 col-lg-2">
					<a href="#" class="thumbnails"><img
							src="/images/footer/photos6.jpg" alt="Image"></a>
				</div>
			</div>
			<div class="swiper-button-prev circle-arrow">
				<i class="fa fa-chevron-left"></i>
			</div>
			<div class="swiper-button-next circle-arrow">
				<i class="fa fa-chevron-right"></i>
			</div>
		</div>
	</div>
	<div class="sub-footer">
		<div class="container">
			<div class="row">
				<div class="col-sm-12">
					<div class="widget"></div>
					<div class="widget footer-cp-text"></div>
				</div>
			</div>
		</div>
	</div>
</footer>
<!-- Include jQuery and Scripts -->
<script type="text/javascript" src="/js/jquery.min.js"></script>
<script type="text/javascript"
		src="/vendors/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/vendors/jquery.waypoints.min.js"></script>
<script type="text/javascript" src="/vendors/isotope.pkgd.min.js"></script>
<!-- Swiper -->
<script type="text/javascript" src="/vendors/swiper/js/swiper.min.js"></script>
<!-- Magnific-popup -->
<script type="text/javascript" src="/js/scripts.js"></script>
</body>
</html>
